package com.acme.bankapp.domine.account;

import com.acme.bankapp.exceptions.NoEnoughFundsException;

public abstract class AbstractAccount implements Account {

    private int id;
    private double balance;
    private String type;

    public AbstractAccount(final int id, final double amount)
            throws IllegalArgumentException {
        this.id = id;
        if (amount < 0) {
            throw new IllegalArgumentException("Balance can not be negative");
        }
        balance = amount;
    }

    public double getBalance() {
        return balance;
    }

    public void setBalance(final double balance) {
        this.balance = balance;
    }

    public int getId() {
        return id;
    }

    public void deposit(final double amount) {
        if (amount < 0) {
            System.out.println("Amount deposit can not be negative");
            return;
        }
        balance += amount;
    }

    public String getType() {
        return type;
    }

    public void setType(final String type) {
        this.type = type;
    }

    public abstract void withdraw(final double amount)
            throws NoEnoughFundsException;

}
